package com.hxh.learn.vo;

import cn.hutool.core.date.DateUtil;
import com.hxh.learn.model.SysPermissions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * @Author: hxh
 * @Date: 2023/3/7
 */
@Data
public class SysPermissionsInsertVo {
    @ApiModelProperty("上级")
    private Integer parentId;

    @NotBlank
    @ApiModelProperty(value = "菜单名称", required = true)
    private String name;
    @NotBlank
    @ApiModelProperty(value = "请求路径", required = true)
    private String path;
    @NotBlank
    @ApiModelProperty(value = "0无效，1有效", required = true)
    private Integer status;

    public SysPermissions convert() {
        SysPermissions sysPermissions = new SysPermissions();
        sysPermissions.setParentId(parentId);
        sysPermissions.setName(name);
        sysPermissions.setPath(path);
        sysPermissions.setStatus(status);
        sysPermissions.setCreateTime(DateUtil.current());
        return sysPermissions;
    }

}
